home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
EDUCATE
/
CATTEST.ARJ
/
INTEG2.IN1
< prev
next >
Wrap
Text File
|
1991-03-25
|
2KB
|
99 lines
PROCEDURE Init_Question;
VAR
dummy_i {integer, may be deleted}
{integer variables follow:}
: Integer;
{real variables follow:}
dummy_r {real, may be deleted}
,R_zero
: Real;
{string variables follow:}
dummy_s {string, may be deleted}
,A_R_zero
: String;
BEGIN
{$I-}
Assign (OldQuestionFile,Progname_string+'.SAV');
Reset(OldQuestionFile);
{$I+}
IF IOResult = 0 THEN {this is a repeat, there was a .SAV file}
BEGIN
ReadLn(OldQuestionFile,R_zero);
Close(OldQuestionFile);
END
else {there was no .SAV file, must generate new values}
BEGIN
{question creation section
creating new values for student variables}
R_zero := 0.;
ReWrite(OldQuestionFile);{ create the .SAV file just in case
student needs to quit and do it again}
WriteLn(OldQuestionFile,R_zero);
Close(OldQuestionFile)
END;
STR(R_zero:4:2,A_R_zero);
Trim_fore_aft(A_R_zero);
question := '';
question2 := '';
question := question + ' The integral from pi to zero of sin(x)cos(x)dx is ? ';
If MaxAvail < Sizeof(Wrong_Answers) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(RootErrorPtr);
TempPtr := RootErrorPtr;
TempPtr^.next := nil;
TempPtr^.value := -2.;
TempPtr^.remark := 'Did you integrate sin(x)dx?';
END;
true_answer := R_zero;
{$IFDEF Watch_Student}
WriteLn(Outfile,Time_Stamp);
WriteLn(OutFile,question);
WriteLn(OutFile,'R_zero = ',R_zero);
WriteLn(OutFile,'answer = ',R_zero);
{$ENDIF }
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(RootDebugLinePtr);
TempDebugLinePtr := RootDebugLinePtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_zero = ' + A_R_zero;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_zero = ' + A_R_zero;
END;
END {of .IN1};